import { http } from "@/utils/http";
import {ListPageResult,ListResult} from "./models";

/** 获取内容列表 */

export interface aggListItemsType {
  uuid: string;
  mid?: number;
  name: string;
  subject?: string[];
  type?: number;
  thumb: string;
  content: string;
  agg_uuid: string;
  nav_uuid: string;
  entity_uuid: string;
  created_at: string;
}

interface NavigationType {
  name:string
  uuid:string
  isEditing?:boolean
}


export interface BannerType {
  url: string
  thumb: string
  material_uuid: string
}

export interface aggListType {
  uuid: string
  mid: number
  name: string
  type: number
  status: number
  search:{
    thumb:string
    material_uuid:string
  }
  carousel: {
    interval:number
    banner:BannerType[]
  }
  navigation: NavigationType[]
  created_at?: string;
}



export const aggListContentList = (uuid:string,params?: object) => {
  return http.request<ListPageResult<aggListItemsType>>("get", `/api/open/resource/aggList/index/${uuid}`, {
    params
  });
}



interface bannerType{
  name:string
  url:string
}
interface NavType{
  uid:string
  name:string
}
export interface aggListInfoType{
  name:string
  logo:string
  banner:bannerType[]
  nav:NavType[]
}
export const aggListInfo = (uuid: string) => {
  return http.request<ListResult<aggListType>>("get", `/api/open/resource/aggList/${uuid}`);
}
